#include <machine/asm.h>

#if defined(_KERNEL) || defined(_STANDALONE)
#define BSWAP16 _C_LABEL(bswap16)
#else /* defined(_KERNEL) || defined(_STANDALONE) */
#define BSWAP16 _C_LABEL(__bswap16)
#endif /* defined(_KERNEL) || defined(_STANDALONE) */

_ENTRY(BSWAP16)
#ifdef __mcfisac__
	mvzw	6(%sp),%d0
	swap	%d0
	byterev	%d0
#elif defined(__mcoldfire__)
	mvzw	6(%sp),%d0
	movl	%d0,%d1
	mvzb	%d0,%d0
	lsll	#8,%d0
	lsrl	#8,%d1
	orl	%d1,%d0
#else
	movl	4(%sp),%d0
	rolw	#8,%d0
#endif
	rts
END(BSWAP16)
